﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Models.Extension
{
    public class CacheEntity<T>
    {
        public CacheEntity()
        {
            this.AddMinute = 20; //默认缓存持续时间，20分钟
        }
        /// <summary>
        /// 缓存时间
        /// </summary>
        /// <param name="addMinute">缓存分钟</param>
        public CacheEntity(int addMinute)
        {
            this.AddMinute = addMinute;
            this.isQueryEvery = false;
        }
        /// <summary>
        /// 每次都执行查询
        /// </summary>
        /// <param name="IsQuery">每次都执行查询</param>
        public CacheEntity(bool IsQuery)
        {
            this.isQueryEvery = IsQuery;
        }
        public string EntityName { get; set; }

        /// <summary>
        /// 缓存的List对象
        /// </summary>
        public List<T> EntityValue { get; set; }

        /// <summary>
        /// 下次更新时间
        /// </summary>
        public DateTime NextUpdateTime { get; set; }
        public string EntityStringValue { get; set; }
        /// <summary>
        /// 执行一次查询
        /// </summary>
        public bool isQuery { get; set; }

        /// <summary>
        /// 每次都执行查询
        /// </summary>
        public bool isQueryEvery { get; set; }

        /// <summary>
        /// 设置缓存时间
        /// </summary>
        public int AddMinute { get; set; }
    }
}
